<!DOCTYPE html>
<html>
<head>
    <title>审核文件列表</title>
    <link rel="STYLESHEET" type="text/css" href="codebase/dhtmlx.css">
    <link rel="STYLESHEET" type="text/css" href="codebase/css/common/common.css">
    <script src="codebase/dhtmlx.js" type="text/javascript"></script>
    <script>
		var docLayout,mygrid,toolbar,myForm;
		
		
        function buildInterface(){
			dhtmlx.image_path = "codebase/imgs/";
			docLayout = new dhtmlXLayoutObject(document.body, "2E");
			docLayout.cells('a').hideHeader();
			docLayout.cells('b').setText("详情");
			
			loadGrid();
        }
        
		
		function loadGrid(){
			mygrid = docLayout.cells('a').attachGrid();
			mygrid.setImagePath("codebase/imgs/");
			mygrid.setHeader(",文件名,文件尺寸,上传时间,提交审核人,状态");
			mygrid.setInitWidths("50,300,60,130,100,50");
			mygrid.setColAlign("center,left,left,right,center,center");
			mygrid.setColTypes("img,ro,ro,ro,ro,ro");
			mygrid.setColSorting("str,str,str,int,str,str");
			mygrid.setSkin("dhx_skyblue");
			mygrid.init();
			mygrid.loadXML("/fileCenter/review/listReview.do");
			
			mygrid.attachEvent("onRowSelect", function(id) {
				dhtmlxAjax.get("/fileCenter/review/showReview.do?id=" + id, function(loader){
	            	var data = loader.xmlDoc.responseText;
	            	eval("var rst = " + data);
	            	myForm = docLayout.cells('b').attachForm(rst);
	            	attachEvent();
	            });
			});
		}
		
		function attachEvent() {
			myForm.attachEvent("onButtonClick", function(name, command){
				if (command == "download") {
					doDownload();
				} else if (command == "save") {
					doSave();
				}
			});
		}
		
		function doDownload() {
			var fileId = myForm.getItemValue("fileId");
			window.open("/fileCenter/file/download.do?fid=" + fileId);
		}
		
		function doSave() {
			myForm.send("/fileCenter/review/finishReview.do", "post", function(loader){
				var data = loader.xmlDoc.responseText;
	            eval("var rst = " + data);
	            alert(rst.msg);
			});
		}
		
	
        dhtmlxEvent(window,"load", buildInterface);
    </script>
</head>
<body>
</body>
</html>